/*
 * Copyright (c) 2015—2030 GantSoftware.Co.Ltd. All rights reserved.
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * is not allowed to be distributed or copied without the license from
 * GantSoftware.Co.Ltd. Please contact the company for more information.
 */
package com.gantang.gax.controller;

import com.gantang.gax.dto.ResultDto;
import com.gantang.gax.dto.bool.BoolFeatureTable;
import com.gantang.gax.service.BoolFeatureTableService;
import com.gantang.gax.service.LogicDeductionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("gax-bool")
public class GaxBoolController {
    @Autowired
    private BoolFeatureTableService logicBoolFeatureTableService;
    @Autowired
    private LogicDeductionService logicDeductionService;

    //发起任务
    @PostMapping("startTask")
    public ResultDto startTask(@RequestBody BoolFeatureTable boolFeatureTable) {
        logicBoolFeatureTableService.doUpsertFeatureTable(boolFeatureTable);
        return ResultDto.success();
    }

    /**
     * 测试接口 - 获取推荐的组合
     *
     * @param boolFeatureTable
     * @return
     */
    @PostMapping("recommend")
    public List<String> recommend(@RequestBody BoolFeatureTable boolFeatureTable) {
        List<String> solution = logicDeductionService.doGetRecommendCombination(boolFeatureTable);
        return solution;
    }
}
